<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>ESP8266_RTOS_SDK: Force Sleep APIs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ESP8266_RTOS_SDK
   &#160;<span id="projectnumber">v1.4.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Force Sleep APIs<div class="ingroups"><a class="el" href="group__WiFi__APIs.html">WiFi Related APIs</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>WiFi Force Sleep APIs.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gae5abca4a52b032d19ba1a411eaaa487a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gae5abca4a52b032d19ba1a411eaaa487a"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>fpm_wakeup_cb</b>) (void)</td></tr>
<tr class="separator:gae5abca4a52b032d19ba1a411eaaa487a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga18a528b1a07c371a92fec9668a8526bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#ga18a528b1a07c371a92fec9668a8526bf">wifi_fpm_open</a> (void)</td></tr>
<tr class="memdesc:ga18a528b1a07c371a92fec9668a8526bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable force sleep function.  <a href="#ga18a528b1a07c371a92fec9668a8526bf">More...</a><br /></td></tr>
<tr class="separator:ga18a528b1a07c371a92fec9668a8526bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa20f76f974962fe47ae31c0f65b657c1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#gaa20f76f974962fe47ae31c0f65b657c1">wifi_fpm_close</a> (void)</td></tr>
<tr class="memdesc:gaa20f76f974962fe47ae31c0f65b657c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable force sleep function.  <a href="#gaa20f76f974962fe47ae31c0f65b657c1">More...</a><br /></td></tr>
<tr class="separator:gaa20f76f974962fe47ae31c0f65b657c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa0c860b5a8fac128712596db935b174c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#gaa0c860b5a8fac128712596db935b174c">wifi_fpm_do_wakeup</a> (void)</td></tr>
<tr class="memdesc:gaa0c860b5a8fac128712596db935b174c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wake ESP8266 up from MODEM_SLEEP_T force sleep.  <a href="#gaa0c860b5a8fac128712596db935b174c">More...</a><br /></td></tr>
<tr class="separator:gaa0c860b5a8fac128712596db935b174c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga60a15e23e9026636a71251e0fe46b16d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#ga60a15e23e9026636a71251e0fe46b16d">wifi_fpm_set_wakeup_cb</a> (fpm_wakeup_cb cb)</td></tr>
<tr class="memdesc:ga60a15e23e9026636a71251e0fe46b16d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set a callback of waken up from force sleep because of time out.  <a href="#ga60a15e23e9026636a71251e0fe46b16d">More...</a><br /></td></tr>
<tr class="separator:ga60a15e23e9026636a71251e0fe46b16d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga51dffd1b54e5a225378632d08162b048"><td class="memItemLeft" align="right" valign="top">sint8&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#ga51dffd1b54e5a225378632d08162b048">wifi_fpm_do_sleep</a> (uint32 sleep_time_in_us)</td></tr>
<tr class="memdesc:ga51dffd1b54e5a225378632d08162b048"><td class="mdescLeft">&#160;</td><td class="mdescRight">Force ESP8266 enter sleep mode, and it will wake up automatically when time out.  <a href="#ga51dffd1b54e5a225378632d08162b048">More...</a><br /></td></tr>
<tr class="separator:ga51dffd1b54e5a225378632d08162b048"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8fbbe4c4d1399e6e39bb8ae1f0c10737"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#ga8fbbe4c4d1399e6e39bb8ae1f0c10737">wifi_fpm_set_sleep_type</a> (sleep_type type)</td></tr>
<tr class="memdesc:ga8fbbe4c4d1399e6e39bb8ae1f0c10737"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set sleep type for force sleep function.  <a href="#ga8fbbe4c4d1399e6e39bb8ae1f0c10737">More...</a><br /></td></tr>
<tr class="separator:ga8fbbe4c4d1399e6e39bb8ae1f0c10737"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga46b8069d18c7d8657dae947bc3c47faa"><td class="memItemLeft" align="right" valign="top">sleep_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__WiFi__Force__Sleep__APIs.html#ga46b8069d18c7d8657dae947bc3c47faa">wifi_fpm_get_sleep_type</a> (void)</td></tr>
<tr class="memdesc:ga46b8069d18c7d8657dae947bc3c47faa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get sleep type of force sleep function.  <a href="#ga46b8069d18c7d8657dae947bc3c47faa">More...</a><br /></td></tr>
<tr class="separator:ga46b8069d18c7d8657dae947bc3c47faa"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>WiFi Force Sleep APIs. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaa20f76f974962fe47ae31c0f65b657c1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wifi_fpm_close </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disable force sleep function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
<a class="anchor" id="ga51dffd1b54e5a225378632d08162b048"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sint8 wifi_fpm_do_sleep </td>
          <td>(</td>
          <td class="paramtype">uint32&#160;</td>
          <td class="paramname"><em>sleep_time_in_us</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Force ESP8266 enter sleep mode, and it will wake up automatically when time out. </p>
<dl class="section attention"><dt>Attention</dt><dd>1. This API can only be called when force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close. </dd>
<dd>
2. If this API returned 0 means that the configuration is set successfully, but the ESP8266 will not enter sleep mode immediately, it is going to sleep in the system idle task. Please do not call other WiFi related function right after calling this API.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">uint32</td><td>sleep_time_in_us : sleep time, ESP8266 will wake up automatically when time out. Unit: us. Range: 10000 ~ 268435455(0xFFFFFFF).<ul>
<li>If sleep_time_in_us is 0xFFFFFFF, the ESP8266 will sleep till</li>
<li>if wifi_fpm_set_sleep_type is set to be LIGHT_SLEEP_T, ESP8266 can wake up by GPIO.</li>
<li>if wifi_fpm_set_sleep_type is set to be MODEM_SLEEP_T, ESP8266 can wake up by wifi_fpm_do_wakeup.</li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0, setting succeed; </dd>
<dd>
-1, fail to sleep, sleep status error; </dd>
<dd>
-2, fail to sleep, force sleep function is not enabled. </dd></dl>

</div>
</div>
<a class="anchor" id="gaa0c860b5a8fac128712596db935b174c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wifi_fpm_do_wakeup </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Wake ESP8266 up from MODEM_SLEEP_T force sleep. </p>
<dl class="section attention"><dt>Attention</dt><dd>This API can only be called when MODEM_SLEEP_T force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
<a class="anchor" id="ga46b8069d18c7d8657dae947bc3c47faa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sleep_type wifi_fpm_get_sleep_type </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get sleep type of force sleep function. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>sleep type </dd></dl>

</div>
</div>
<a class="anchor" id="ga18a528b1a07c371a92fec9668a8526bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wifi_fpm_open </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable force sleep function. </p>
<dl class="section attention"><dt>Attention</dt><dd>Force sleep function is disabled by default.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">null</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
<a class="anchor" id="ga8fbbe4c4d1399e6e39bb8ae1f0c10737"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wifi_fpm_set_sleep_type </td>
          <td>(</td>
          <td class="paramtype">sleep_type&#160;</td>
          <td class="paramname"><em>type</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set sleep type for force sleep function. </p>
<dl class="section attention"><dt>Attention</dt><dd>This API can only be called before wifi_fpm_open.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sleep_type</td><td>type : sleep type</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
<a class="anchor" id="ga60a15e23e9026636a71251e0fe46b16d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void wifi_fpm_set_wakeup_cb </td>
          <td>(</td>
          <td class="paramtype">fpm_wakeup_cb&#160;</td>
          <td class="paramname"><em>cb</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set a callback of waken up from force sleep because of time out. </p>
<dl class="section attention"><dt>Attention</dt><dd>1. This API can only be called when force sleep function is enabled, after calling wifi_fpm_open. This API can not be called after calling wifi_fpm_close. </dd>
<dd>
2. fpm_wakeup_cb_func will be called after system woke up only if the force sleep time out (wifi_fpm_do_sleep and the parameter is not 0xFFFFFFF). </dd>
<dd>
3. fpm_wakeup_cb_func will not be called if woke up by wifi_fpm_do_wakeup from MODEM_SLEEP_T type force sleep.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">void</td><td>(*fpm_wakeup_cb_func)(void) : callback of waken up</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>null </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Mar 1 2016 10:19:26 for ESP8266_RTOS_SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.10
</small></address>
</body>
</html>
